package com.sanpu.kxe.business.login.provider;

import android.content.Context;
import android.content.Intent;

import com.sanpu.kxe.business.login.contract.LoginConfig;
import com.sanpu.kxe.business.login.model.LoginModel;
import com.sanpu.kxe.business.login.view.ModifyAccountActivity;
import com.sanpu.kxe.business.login.view.SetPasswordActivity;
import com.sanpu.kxe.utils.IntentTool;
import com.sanpu.kxe.utils.annotation.ModuleAnnotation;

import rx.Observable;

/**
 * Description：login模块的provider
 * Created by 薛勇军 on 2018/7/12.
 */
@ModuleAnnotation(module = "kxeprovider")
public class LoginProvider implements ILoginProvider {

    @Override
    public void openUpdateLoginPwdActivity(Context context) {
        Intent builder = new Intent(context, SetPasswordActivity.class);
        builder.putExtra(LoginConfig.PWD_TYPE, LoginConfig.UPDATE_PWD);
        IntentTool.startActivity(context, builder);
    }

    @Override
    public void openUpdatePayPwdActivity(Context context) {
        Intent builder = new Intent(context, SetPasswordActivity.class);
        builder.putExtra(LoginConfig.PWD_TYPE, LoginConfig.PAY_PWD);
        IntentTool.startActivity(context, builder);
    }

    @Override
    public void openModifyAccountActivity(Context context) {
        IntentTool.startActivity(context, ModifyAccountActivity.class);
    }

    @Override
    public Observable<String> sendSms(String accountName, String smsType) {
        return LoginModel.getInstance().sendSms(accountName, smsType);
    }
}
